﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Data;

using HubbleDataAccess;
using DreamBuilder.Common;

namespace xHubble.SingleWell.DataAccess
{
    public class SingleWellDAL
    {
        /// <summary>
        /// 查询单井资料
        /// </summary>
        /// <param name="keywords"></param>
        /// <param name="pageinfo"></param>
        /// <returns></returns>
        public static DataTable SearchSinglewell(string keywords, PageInfo pageinfo)
        {
            DataTable singlewellTable = null;
            //string bySpace;
            string matchString = HubbleHelper.GetMatchStringSelf("v_singlewell", "search_val", keywords);
            string searchSql = string.Format("select between {0} to {1} * from v_singlewell where search_val contains '{2}'"
                ,pageinfo.PageSize*(pageinfo.PageIndex-1)
                ,pageinfo.PageSize*pageinfo.PageIndex-1
                ,matchString
                );
            singlewellTable = HubbleDBAccess.ExecuteDataTable(searchSql);
            pageinfo.RecordCount = singlewellTable.MinimumCapacity;
            return singlewellTable;
        }
    }
}
